<extend name="Base/common" />
<block name="header">
  <style type="text/css">
    .aui-card { margin-top: 15px; }
    .aui-input-addon.aui-iconfont { font-size: 20px !important; }
    .aui-input-row { width: 100% !important; }
  </style>
</block>

<block name="body">

  <div class="aui-content aui-card">
    <div class="aui-form">
      <div class="aui-input-row"> <i class="aui-input-addon aui-iconfont aui-icon-people aui-text-info"></i>
        <input id="tel" type="text" class="aui-input" placeholder="用户名输入手机号" />
      </div>
      <div class="aui-input-row   aui-hide">
        <input type="number" class="aui-input" id="code" placeholder="请输入收到的验证码" />
      <span class="aui-input-addon">
      <button class="aui-btn" id="sendVerify" onclick="GetCode()">获取验证码</button>
      </span> </div>
      <div class="aui-input-row"> <i class="aui-input-addon aui-iconfont aui-icon-lock aui-text-warning"></i>
        <input type="password" id="password" class="aui-input" placeholder="密码" />
        <i class="aui-input-addon aui-iconfont aui-icon-attention aui-text-default" tapmode id="showpass-btn"></i> </div>
      <div class="aui-input-row"> <i class="aui-input-addon aui-iconfont aui-icon-lock aui-text-warning"></i>
        <input id="password1" type="password" class="aui-input" placeholder="确认密码" />
      </div>
      <div class="aui-input-row"> <span class="aui-input-addon">用户昵称:</span>
        <input id="UserRealName" type="text" class="aui-input" placeholder="请输入用户昵称，不能修改" />
      </div>
      <div class="aui-input-row "><span class="aui-input-addon">推荐人:</span>
        <input id="FUserName" type="text" class="aui-input" readonly placeholder="推荐人"  value=""/>
      </div>
      <div class="aui-input-row"> <span class="aui-input-addon">验证码:</span>
        <input id="webcode" type="text" class="aui-input" placeholder="请输入验证码" />
        <i class="aui-input-addon aui-iconfont reloadverify"><img class="verifyimg" src="{:U('verify')}" style="width: 50px; height: 20px;"/></i> </div>
      <div class="aui-input-row  aui-hide"> <span class="aui-input-addon">推荐码:</span>
        <input id="UserTel" type="text" class="aui-input" readonly placeholder="FUId" />
      </div>
      <div class="aui-input-row aui-hide"> <span class="aui-input-addon">城市:</span>
        <input id="city" type="text" class="aui-input" placeholder="城市" readonly />
      </div>
      <div class="aui-input-row aui-hide"> <span class="aui-input-addon">省份:</span>
        <input id="province" type="text" class="aui-input" placeholder="省份" readonly />
      </div>
      <div class="aui-input-row aui-hide"> <span class="aui-input-addon">国家:</span>
        <input id="country" type="text" class="aui-input" placeholder="国家" readonly />
      </div>
      <div class="aui-input-row aui-hide"> <span class="aui-input-addon">用户昵称:</span>
        <input id="WxOpenId" type="text" class="aui-input" placeholder="微信OpenId" />
      </div>
      <div class="aui-input-row"> <span class="aui-input-addon">用户头像：</span> <img id="Images" src="__MAST_HOME__/picture/daihead.jpg" width="60" height="60" /> </div>
      <div id="hide" class="aui-btn-row aui-hide aui-bg-success" style="padding: 5px;color:#FFF"></div>
      <div class="aui-btn-row">
        <button id="bu" class="aui-btn aui-btn-block aui-btn-warning" onclick="save()">注册</button>
      </div>
    </div>
  </div>
  <div class="aui-toast" style="display:none;width:150px" id="fail"> <i class="aui-iconfont aui-icon-roundclose"></i>
    <div class="aui-toast-content contents"> </div>
  </div>
  <div class="aui-toast" style="display:none;width:150px" id="su">
    <div class="aui-toast-loading"></div>
    <div class="aui-toast-content contents"> </div>
  </div>

</block>
<block name="script">
	<script type="text/javascript">
    	$(document)
	    	.ajaxStart(function(){
	    		$("button:submit").addClass("log-in").attr("disabled", true);
	    	})
	    	.ajaxStop(function(){
	    		$("button:submit").removeClass("log-in").attr("disabled", false);
	    	});
    	$("form").submit(function(){
    		var self = $(this);
    		$.post(self.attr("action"), self.serialize(), success, "json");
    		return false;

    		function success(data){
    			if(data.status){
    				window.location.href = data.url;
    			} else {
    				self.find(".Validform_checktip").text(data.info);
    				//刷新验证码
    				$(".reloadverify").click();
    			}
    		}
    	});

		$(function(){
			var verifyimg = $(".verifyimg").attr("src");
            $(".reloadverify").click(function(){
                if( verifyimg.indexOf('?')>0){
                    $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
                }else{
                    $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
                }
            });
		});
	</script>

</block>
